import request from '@/utils/request'
import { ApiModulesRoutes } from '@/consts.js'

/**
 * 分页查询区域
 * @param {String} data.pageNo
 * @param {String} data.pageSize
 */

export function getRegionList(data) {
  return request({
    url: `${ApiModulesRoutes.BASE}/region/findRegionPageByParam`,
    method: 'POST',
    data,
  })
}

/**
 * 添加区域
 * @param {String} data.name
 */

export function addRegion(data) {
  return request({
    url: `${ApiModulesRoutes.BASE}/region/addRegion`,
    method: 'POST',
    data,
  })
}

/**
 * 删除用户
 * @param {string} regionId
 */

export function delRegion(regionId) {
  return request({
    url: `${ApiModulesRoutes.BASE}/region/delRegion`,
    method: 'GET',
    params: { regionId },
  })
}


/**
 * 添加区域
 * @param {String} data.id 区域id
 * @param {String} data.locationVos 区域坐标点
 */

export function apiSetLocation(data) {
  return request({
    url: `${ApiModulesRoutes.BASE}/region/setLocations`,
    method: 'POST',
    data,
  })
}
